__author__ = 'tyrion'

import urllib
import urllib2

def GetHttpRequest(url):
    req = urllib2.Request(url)

    res_data = urllib2.urlopen(req)
    code = res_data.getcode()
    res = res_data.read()
    return res, code

def PostHttpRequest(url, Data):

    # test_data = {'ServiceCode':'aaaa','b':'bbbbb'}
    # test_data_urlencode = urllib.urlencode(test_data)
    #
    # requrl = "http://192.168.81.16/cgi-bin/python_test/test.py"

    Para = urllib.urlencode(Data)
    print Para
    req = urllib2.Request(url , Para)

    ResData = urllib2.urlopen(req)
    code = ResData.getcode()
    print("info code " )
    print(code)
    ret = ResData.read()
    return ret

def  GetFile(fileName):
    return






